package com.hqx.oop.inner;

public class Outer {
    private static int shared = 100;
    private int count = 10;
    public static class StaticInner {
        public void innerMethod() {
            System.out.println("inner "+shared);
//            System.out.println("count "+count); //静态内部类只能问外部类静态变量和方法
        }
    }
    public void test() {
//        StaticInner si = new StaticInner();
//        si.innerMethod();
        Inner inner  = new Inner();
        inner.innerMethod();
    }

    public void testMethodInner (final int param) {
        final String str = "hello";
        class Inner {
            public void InnerMethod() {
                System.out.println("outer count "+count);
                System.out.println("param "+param);
                System.out.println("local var "+str);
            }
        }
        Inner inner = new Inner();
        inner.InnerMethod();

    }

    public class Inner {
        public void innerMethod() {
            System.out.println("count "+count);
            System.out.println("static shared "+shared);
        }
    }



    public static void main(String[] args) {
//        Outer.StaticInner si = new Outer.StaticInner();
//        si.innerMethod();
//        Outer.Inner inner = new Outer.Inner();
//        Outer outer = new Outer();
//        Outer.Inner inner = outer.new Inner();
//        inner.innerMethod();
        new Outer().testMethodInner(15);

    }
}
